<template>
  <div class="app-container">
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>时间：{{ this.info.dataTime }}</span>
      </div>
      <div id="print-div" class="mainBox" style="height: 1250px">
        <div class="title_div">
          <img
            src="@/icons/img/changzhi.png"
            style="width: 30px; height: 30px"
          />{{ this.$store.state.City }}医院<br />
          俯卧位通气治疗记录单(一)
        </div>
        <div class="warp">
          <div class="two" style="height: 60px; width: 940px">
            <div class="longger_div" style="height: 60px; width: 60px">
              基本<br />信息
            </div>
            <div
              class="short_div"
              style="height: 30px; width: 880px; text-align: left"
            >
              <span style="margin-left: 15px">
                姓名：{{ this.data.name }}
              </span>
              <span style="margin-left: 15px"> 性别：{{ this.data.sex }} </span>
              <span style="margin-left: 15px"> 年龄：{{ this.$store.state.user.severFall.ageOrMonthAge}} </span>
              <span style="margin-left: 15px">
                住院号：{{ this.data.visit_id }}
              </span>
              <span style="margin-left: 15px">
                诊断：{{ this.data.diagnosis_name }}
              </span>
            </div>
            <div
              class="short_div"
              style="height: 30px; width: 350px; text-align: left"
            >
              人工气道:(ET/TT)
              <input
                v-model="info.code1"
                class="input-type"
                style="text-align: left"
              />
              mm
            </div>
            <div
              class="short_div"
              style="height: 30px; width: 120px; text-align: left"
            >
              深度
              <input
                v-model="info.code2"
                class="input-type"
                style="width: 30px; text-align: left"
              />
              cm
            </div>
            <div
              class="short_div"
              style="height: 30px; width: 170px; text-align: left"
            >
              呼吸支持天数:
              <input
                v-model="info.code3"
                class="input-type"
                style="width: 30px; text-align: left"
              />天
            </div>
            <div
              class="short_div"
              style="height: 30px; width: 240px; text-align: left"
            >
              俯卧位次数:第<input
                v-model="info.code4"
                type="text"
                class="input-type"
                style="width: 30px; text-align: left"
              />次
            </div>
          </div>
          <div class="two" id="date_div">
            <div
              class="long_div"
              style="height: 30px; width: 350px; text-align: left"
            >
              开始时间：
              <el-date-picker
                v-model="info.code5"
                type="datetime"
                :clearable="false"
                style="width: 200px"
                value-format="yyyy-MM-dd HH:mm:ss"
              />
            </div>
            <div
              class="short_div"
              style="height: 30px; width: 350px; text-align: left"
            >
              结束时间：
              <el-date-picker
                v-model="info.code6"
                type="datetime"
                :clearable="false"
                style="width: 200px"
                value-format="yyyy-MM-dd HH:mm:ss"
              />
            </div>
            <div
              class="short_div"
              style="height: 30px; width: 240px; text-align: left"
            >
              总时间：
              <input
                v-model="info.code7"
                type="text"
                class="input-type"
                style="text-align: left"
              />
              h
            </div>
          </div>
          <div class="two">
            <div class="long_div" style="height: 30px; width: 250px">时间</div>
            <div class="short_div" style="height: 30px; width: 100px">
              俯卧位前
            </div>
            <div class="short_div" style="height: 30px; width: 390px">
              俯卧位中
            </div>
            <div class="short_div" style="height: 30px; width: 200px">
              仰卧位后2-4h
            </div>
          </div>
          <div class="two" id="dateTime_div">
            <div class="long_div" style="height: 30px; width: 250px">监测</div>
            <div class="short_div" style="height: 30px; width: 100px">
              （
              <input
                v-model="info.code8"
                type="text"
                class="input-type"
                style="
                  width: 22px;
                  height: 20px;
                  border: 0;
                  outline: 0;
                  text-align: left;
                "
              />:
              <input
                v-model="info.code9"
                type="text"
                class="input-type"
                style="
                  width: 22px;
                  height: 20px;
                  border: 0;
                  outline: 0;
                  text-align: left;
                "
              />
              ）
            </div>
            <div class="short_div" style="height: 30px; width: 175px">
              俯卧位后2-4h(
              <input
                v-model="info.code10"
                type="text"
                class="input-type"
                style="
                  width: 22px;
                  height: 20px;
                  border: 0;
                  outline: 0;
                  text-align: left;
                "
              />:
              <input
                v-model="info.code11"
                type="text"
                class="input-type"
                style="
                  width: 22px;
                  height: 20px;
                  border: 0;
                  outline: 0;
                  text-align: left;
                "
              />
              )
            </div>
            <div class="short_div" style="height: 30px; width: 215px">
              俯卧位结束前(
              <input
                v-model="info.code12"
                type="text"
                class="input-type"
                style="width: 22px; height: 20px; border: 0; outline: 0"
              />:
              <input
                v-model="info.code13"
                type="text"
                class="input-type"
                style="width: 22px; height: 20px; border: 0; outline: 0"
              />
              )
            </div>
            <div class="short_div" style="height: 30px; width: 200px">
              (
              <input
                v-model="info.code14"
                type="text"
                class="input-type"
                style="width: 22px; height: 20px; border: 0; outline: 0"
              />:
              <input
                v-model="info.code15"
                type="text"
                class="input-type"
                style="width: 22px; height: 20px; border: 0; outline: 0"
              />
              )
            </div>
          </div>
          <div class="two" style="width: 940px; height: 840px">
            <div class="short_div" style="height: 120px; width: 50px">
              <div style="width: 20px; writing-mode: tb-rl; margin: 15px">
                生命体征
              </div>
            </div>
            <div class="longer_div" style="text-align: left">T (℃)</div>
            <div class="short_div">
              <input v-model="info.code16" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code17" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code18" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code19" type="text" class="input-type" />
            </div>

            <div class="longer_div" style="text-align: left">HR (次/分)</div>
            <div class="short_div">
              <input v-model="info.code20" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code21" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code22" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code23" type="text" class="input-type" />
            </div>

            <div class="longer_div" style="text-align: left">BP（mmHg）</div>
            <div class="short_div">/</div>
            <div class="long_div">/</div>
            <div class="shorter_div">/</div>
            <div class="longger_div">/</div>

            <div class="longer_div" style="text-align: left">SpO2 (%)</div>
            <div class="short_div">
              <input v-model="info.code24" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code25" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code26" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code27" type="text" class="input-type" />
            </div>

            <div class="short_div" style="height: 390px; width: 50px">
              <div
                style="
                  height: 390px;
                  width: 20px;
                  writing-mode: tb-rl;
                  margin: 15px;
                "
              >
                机械通气设置及监测
              </div>
            </div>
            <div class="longer_div" style="text-align: left">MODE</div>
            <div class="short_div">
              <input v-model="info.code28" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code29" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code30" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code31" type="text" class="input-type" />
            </div>

            <div class="longer_div" style="text-align: left">
              Pinsp/∆PS (cmH2O)
            </div>
            <div class="short_div">
              <input v-model="info.code32" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code33" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code34" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code35" type="text" class="input-type" />
            </div>

            <div class="longer_div" style="text-align: left">PEEP (cmH2O)</div>
            <div class="short_div">
              <input v-model="info.code36" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code37" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code38" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code39" type="text" class="input-type" />
            </div>

            <div class="longer_div" style="text-align: left">FiO2</div>
            <div class="short_div">
              <input v-model="info.code40" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code41" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code42" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code43" type="text" class="input-type" />
            </div>

            <div class="longer_div" style="text-align: left">RR (次/分)</div>
            <div class="short_div">
              <input v-model="info.code44" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code45" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code46" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code47" type="text" class="input-type" />
            </div>

            <div class="longer_div" style="text-align: left">VT (ml)</div>
            <div class="short_div">
              <input v-model="info.code48" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code49" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code50" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code51" type="text" class="input-type" />
            </div>

            <div class="longer_div" style="text-align: left">Flow (L/min)</div>
            <div class="short_div">
              <input v-model="info.code52" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code53" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code54" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code55" type="text" class="input-type" />
            </div>

            <div class="longer_div" style="text-align: left">MV(L/min)</div>
            <div class="short_div">
              <input v-model="info.code56" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code57" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code58" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code59" type="text" class="input-type" />
            </div>

            <div class="longer_div" style="text-align: left">
              Ppeak/Pplat(cmH2O)
            </div>
            <div class="short_div">/</div>
            <div class="long_div">/</div>
            <div class="shorter_div">/</div>
            <div class="longger_div">/</div>

            <div class="longer_div" style="text-align: left">R (cmH2O/L/s)</div>
            <div class="short_div">
              <input v-model="info.code60" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code61" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code62" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code63" type="text" class="input-type" />
            </div>

            <div class="longer_div" style="text-align: left">C(ml/cmH2O)</div>
            <div class="short_div">
              <input v-model="info.code64" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code65" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code66" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code67" type="text" class="input-type" />
            </div>

            <div class="longer_div" style="text-align: left">PEEPi (cmH2O)</div>
            <div class="short_div">
              <input v-model="info.code68" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code69" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code70" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code71" type="text" class="input-type" />
            </div>

            <div class="longer_div" style="text-align: left">
              other (
              <input v-model="info.code72" type="text" class="input-type" />
              )
            </div>
            <div class="short_div">
              <input v-model="info.code73" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code74" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code75" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code76" type="text" class="input-type" />
            </div>

            <div class="long_div" style="height: 120px; width: 50px">
              <div style="width: 20px; writing-mode: tb-rl; margin: 15px">
                气道管理
              </div>
            </div>
            <div class="longer_div" style="text-align: left">
              CuffPress(cmH2O)
            </div>
            <div class="short_div">
              <input v-model="info.code77" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code78" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code79" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code80" type="text" class="input-type" />
            </div>

            <div class="longer_div" style="text-align: left">
              Suction (次/h)
            </div>
            <div class="short_div">
              <input v-model="info.code81" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code82" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code83" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code84" type="text" class="input-type" />
            </div>

            <div class="longer_div" style="text-align: left">Color</div>
            <div class="short_div">
              <input v-model="info.code85" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code86" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code87" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code88" type="text" class="input-type" />
            </div>

            <div class="longer_div" style="text-align: left">Visco</div>
            <div class="short_div">
              <input v-model="info.code89" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code90" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code91" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code92" type="text" class="input-type" />
            </div>

            <div class="long_div" style="height: 210px; width: 50px">
              <div style="width: 20px; writing-mode: tb-rl; margin: 15px">
                血气变化
              </div>
            </div>
            <div class="longer_div" style="text-align: left">pH</div>
            <div class="short_div">
              <input v-model="info.code93" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code94" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code95" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code96" type="text" class="input-type" />
            </div>

            <div class="longer_div" style="text-align: left">PaCO2（mmHg）</div>
            <div class="short_div">
              <input v-model="info.code97" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code98" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code99" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code100" type="text" class="input-type" />
            </div>

            <div class="longer_div" style="text-align: left">PaO2 （mmHg）</div>
            <div class="short_div">
              <input v-model="info.code101" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code102" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code103" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code104" type="text" class="input-type" />
            </div>

            <div class="longer_div" style="text-align: left">
              HCO3- (mmol/L)
            </div>
            <div class="short_div">
              <input v-model="info.code105" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code106" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code107" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code108" type="text" class="input-type" />
            </div>

            <div class="longer_div" style="text-align: left">BE (mmol/L)</div>
            <div class="short_div">
              <input v-model="info.code109" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code110" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code111" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code112" type="text" class="input-type" />
            </div>

            <div class="longer_div" style="text-align: left">Lac (mmol/L)</div>
            <div class="short_div">
              <input v-model="info.code113" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code114" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code115" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code116" type="text" class="input-type" />
            </div>

            <div class="longer_div" style="text-align: left">PFR</div>
            <div class="short_div">
              <input v-model="info.code117" type="text" class="input-type" />
            </div>
            <div class="long_div">
              <input v-model="info.code118" type="text" class="input-type" />
            </div>
            <div class="shorter_div">
              <input v-model="info.code119" type="text" class="input-type" />
            </div>
            <div class="longger_div">
              <input v-model="info.code120" type="text" class="input-type" />
            </div>
          </div>
          <div style="width: 940px">俯卧位操作记录：</div>
          <div style="width: 940px">
            <textarea
              ref="textarea"
              :style="{ height: '120px', width: '940px' }"
              v-model="info.code121"
              class="textarea"
            ></textarea>
          </div>

          <div style="width: 940px">
            注：ET:气管插管 TT：气管切开 Suction
            (次/h)：每小时吸痰次数;操作记录记载特殊情况。R/C/PEEPi可视患者情况而测定。
          </div>
        </div>

        <el-drawer title="评估列表" :visible.sync="table" direction="rtl">
          <el-table :data="gridData">
            <el-table-column
              label="序号"
              type="index"
              align="center"
              width="80"
            />
            <el-table-column
              property="createTime"
              label="评估时间"
              width="150"
              align="center"
            />
            <el-table-column
              property="operatorCode"
              label="评估人"
              width="150"
              align="center"
            />
            <el-table-column label="操作" width="154" align="center">
              <template slot-scope="scope">
                <el-button
                  slot="reference"
                  size="mini"
                  style="margin-left: 10px"
                  type="primary"
                  @click="choice(scope)"
                  >选择</el-button
                >
                <el-popover
                  :ref="`popover-${scope.$index}`"
                  trigger="click"
                  placement="top"
                  width="100"
                >
                  <p class="el-icon-warning">确定删除</p>
                  <div style="text-align: right; margin: 0">
                    <el-button size="mini" type="text" @click="no(scope)"
                      >取消</el-button
                    >
                    <el-button type="primary" size="mini" @click="yes(scope)"
                      >确定</el-button
                    >
                  </div>
                  <el-button
                    slot="reference"
                    size="mini"
                    style="margin-left: 10px"
                    type="danger"
                    >删除</el-button
                  >
                </el-popover>
              </template>
            </el-table-column>
          </el-table>
        </el-drawer>
        <div style="text-align: center; margin-top: 1px">
          第{{ this.pageNum }}页
        </div>
      </div>
      <div
          style="
            position: fixed;
            right: 0;
            bottom: 0;
            z-index: 9;
            width: 100%;
            height: 56px;
            line-height: 56px;
            padding: 0 60px 0 18px;
            background: #fff;
            border-top: 1px solid #e8eaec;
            box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.03);
          "
        >
          <el-button
            type="primary"
            style="position: absolute; right: 20px; top: 8px"
            @click="btn"
            :disabled=garbage
            >保存</el-button
          >

          <el-button
            type="primary"
            style="position: absolute; right: 102px; top: 8px"
            @click="daying"
            :disabled=garbage
            >打印</el-button
          >
          <el-button
            type="primary"
            style="position: absolute; right: 185px; top: 8px"
            @click="reload"
            :disabled=garbage
            >刷新</el-button
          >

          <el-button
            type="primary"
            style="position: absolute; right: 270px; top: 8px"
            @click="histion()"
            :disabled=garbage
            >历史记录</el-button
          >
          <span style="position: absolute; right: 400px; top: 1px">
            设置页码：
            <input
              v-model="pageNum"
              autocomplete="off"
              spellcheck="false"
              type="text"
              placeholder=""
              oninput="value=value.replace(/[^0-9.]/g,'')"
              style="width: 100px; height: 30px"
            />
          </span>
        </div>
    </el-card>
  </div>
</template>

<script>
import { printExcel } from "@/utils/config"; // 导入模块
import { jyxdPagePrint } from "@/utils/jyxd-page-printer.js";
import {
  patientgetList,
  pronTherapyRecordInsertAndUpdate,
  pronTherapyRecordDelete,
  queryDataPronTherapyRecord,
  queryPronTherapyRecordList, findPage,
} from "@/api/table";
import { Message } from "element-ui";
import { edit } from "../../api/table";
export default {
  data() {
    return {
      pageNum: 1,
      age:"",
      printParam: {
        print_id: "print-div", //完整打印区域最外包裹, id名
        paper_height: "1240", //纸张长度，目前不自动分页，页面代码自行设计分页模式
        paper_width: "850", //纸张宽度，根据横向纵向调整，影响页面折行效果
        preview: "",
      },
      heimeisu: "",
      gridData: [],
      data: [],
      garbage: false,
      table: false,
      info: {
        rowId: "",
        code1: "",
        code2: "",
        code3: "",
        code4: "",
        code5: "",
        code6: "",
        code7: "",
        code8: "",
        code9: "",
        code10: "",
        code11: "",
        code12: "",
        code13: "",
        code14: "",
        code15: "",
        code16: "",
        code17: "",
        code18: "",
        code19: "",
        code20: "",
        code21: "",
        code22: "",
        code23: "",
        code24: "",
        code25: "",
        code26: "",
        code27: "",
        code28: "",
        code29: "",
        code30: "",
        code31: "",
        code32: "",
        code33: "",
        code34: "",
        code35: "",
        code36: "",
        code37: "",
        code38: "",
        code39: "",
        code40: "",
        code41: "",
        code42: "",
        code43: "",
        code44: "",
        code45: "",
        code46: "",
        code47: "",
        code48: "",
        code49: "",
        code50: "",
        code51: "",
        code52: "",
        code53: "",
        code54: "",
        code55: "",
        code56: "",
        code57: "",
        code58: "",
        code59: "",
        code60: "",
        code61: "",
        code62: "",
        code63: "",
        code64: "",
        code65: "",
        code66: "",
        code67: "",
        code68: "",
        code69: "",
        code70: "",
        code71: "",
        code72: "",
        code73: "",
        code74: "",
        code75: "",
        code76: "",
        code77: "",
        code78: "",
        code79: "",
        code80: "",
        code81: "",
        code82: "",
        code83: "",
        code84: "",
        code85: "",
        code86: "",
        code87: "",
        code88: "",
        code89: "",
        code90: "",
        code91: "",
        code92: "",
        code93: "",
        code94: "",
        code95: "",
        code96: "",
        code97: "",
        code98: "",
        code99: "",
        code100: "",
        code101: "",
        code102: "",
        code103: "",
        code104: "",
        code105: "",
        code106: "",
        code107: "",
        code108: "",
        code109: "",
        code110: "",
        code111: "",
        code112: "",
        code113: "",
        code114: "",
        code115: "",
        code116: "",
        code117: "",
        code118: "",
        code119: "",
        code120: "",
        code121: "",
        type: "prone_position_type",
        dataTime: "",
        patientId: "",
      },
    };
  },
  computed: {
    getData() {
      return this.$store.state.user.severFall;
    },
  },
  watch: {
    getData: {
      handler(nVal) {
        this.data = this.$store.state.user.severFall;
        if (this.$store.state.user.severFall == undefined) {
          this.$message({
            message: "请先选择病人",
            type: "warning",
          });
        } else {
          this.huli();
        }
      },
      deep: true,
    },
  },
      created() {
      this.data = this.$store.state.user.severFall;
            patientgetList({ visitId: this.data.visit_id }).then((res) => {
        if(res.data[0].age!==''){
          this.age = res.data[0].age;
        }
    });
  },
  mounted() {
    this.data = this.$store.state.user.severFall;
    if (
      typeof this.data.patient_id != "string" ||
      this.data.patient_id.length < 1
    ) {
      alert("请选择一次病人");
    } else {
      this.huli();
    }
                patientgetList({ visitId: this.data.visit_id }).then((res) => {
        if(res.data[0].age!==''){
          this.age = res.data[0].age;
        }
    });
  },
  methods: {
    //设置页码
    findPageByPatientId(){
      findPage({
        patientId: this.data.patient_id,
      }).then((res) => {
        if(res.data!=null  &&　res.data.length>0){
          this.pageNum=res.data[0].pageNum;
        }else{
          this.pageNum=1;
        }
      });

    },
    huli() {
      this.data = this.$store.state.user.severFall;
      this.info.patientId = this.data.patient_id;
      this.setDiagnosis_nameNew();
      this.info = {
        rowId: "",
        code1: "",
        code2: "",
        code3: "",
        code4: "",
        code5: "",
        code6: "",
        code7: "",
        code8: "",
        code9: "",
        code10: "",
        code11: "",
        code12: "",
        code13: "",
        code14: "",
        code15: "",
        code16: "",
        code17: "",
        code18: "",
        code19: "",
        code20: "",
        code21: "",
        code22: "",
        code23: "",
        code24: "",
        code25: "",
        code26: "",
        code27: "",
        code28: "",
        code29: "",
        code30: "",
        code31: "",
        code32: "",
        code33: "",
        code34: "",
        code35: "",
        code36: "",
        code37: "",
        code38: "",
        code39: "",
        code40: "",
        code41: "",
        code42: "",
        code43: "",
        code44: "",
        code45: "",
        code46: "",
        code47: "",
        code48: "",
        code49: "",
        code50: "",
        code51: "",
        code52: "",
        code53: "",
        code54: "",
        code55: "",
        code56: "",
        code57: "",
        code58: "",
        code59: "",
        code60: "",
        code61: "",
        code62: "",
        code63: "",
        code64: "",
        code65: "",
        code66: "",
        code67: "",
        code68: "",
        code69: "",
        code70: "",
        code71: "",
        code72: "",
        code73: "",
        code74: "",
        code75: "",
        code76: "",
        code77: "",
        code78: "",
        code79: "",
        code80: "",
        code81: "",
        code82: "",
        code83: "",
        code84: "",
        code85: "",
        code86: "",
        code87: "",
        code88: "",
        code89: "",
        code90: "",
        code91: "",
        code92: "",
        code93: "",
        code94: "",
        code95: "",
        code96: "",
        code97: "",
        code98: "",
        code99: "",
        code100: "",
        code101: "",
        code102: "",
        code103: "",
        code104: "",
        code105: "",
        code106: "",
        code107: "",
        code108: "",
        code109: "",
        code110: "",
        code111: "",
        code112: "",
        code113: "",
        code114: "",
        code115: "",
        code116: "",
        code117: "",
        code118: "",
        code119: "",
        code120: "",
        code121: "",
        type: "prone_position_type",
        dataTime: "",
        patientId: "",
      };
      this.getNowDate();
      if (
        this.data.unplanned == "" ||
        this.data.unplanned == null ||
        this.data.unplanned == 0
      ) {
        this.garbage = true;
        alert('请在首页补全患者信息')
        // this.$message({
        //   message: "请在首页补全患者信息",
        //   type: "warning",
        //   duration: 1500,
        // });
        return;
      } else {
        this.garbage = false;
      }
      this.findPageByPatientId();
    },
    //赋值诊断信息
    setDiagnosis_nameNew() {
      patientgetList({ visitId: this.info.visitId }).then((res) => {
        this.heimeisu = res.data[0].diagnosis_name;
      });
    },
    getNowDate() {
      var date = new Date();
      // 年
      var year = date.getFullYear();
      // 月
      var month = date.getMonth() + 1;
      // 日
      var day = date.getDate();
      // 时
      var hh = date.getHours();
      // 分
      var mm = date.getMinutes();
      // 秒
      var ss = date.getSeconds();
      if (Number(month) < 10) {
        month = "0" + month;
      }
      if (Number(day) < 10) {
        day = "0" + day;
      }
      if (Number(hh) < 10) {
        hh = "0" + hh;
      }
      if (Number(mm) < 10) {
        mm = "0" + mm;
      }
      if (Number(ss) < 10) {
        ss = "0" + ss;
      }
      this.info.dataTime =
        year + "-" + month + "-" + day + " " + hh + ":" + mm + ":" + ss;
    },
    //打印
    daying() {
      if (
        typeof this.data.patient_id != "string" ||
        this.data.patient_id.length < 1
      ) {
        alert("请选择一次病人");
      } else {
        jyxdPagePrint(this.printParam);
      }
    },
    //保存
    btn() {
      if (
        typeof this.data.patient_id != "string" ||
        this.data.patient_id.length < 1
      ) {
        alert("请选择一次病人");
      } else {
        if (!this.info.patientId) {
          this.info.patientId = this.data.patient_id;
        }
        pronTherapyRecordInsertAndUpdate(this.info).then((res) => {
          if (res.code === 200) {
            this.$message({
              message: "保存成功",
              type: "success",
            });
          } else {
            this.$message({
              message: "保存失败",
              type: "warning",
            });
          }
        });
      }
    },
    // 刷新
    reload() {
      if (
        typeof this.data.patient_id != "string" ||
        this.data.patient_id.length < 1
      ) {
        alert("请选择一次病人");
      } else {
        this.huli();
      }
    },
    //查看历史记录
    histion() {
      if (
        typeof this.data.patient_id != "string" ||
        this.data.patient_id.length < 1
      ) {
        alert("请选择一次病人");
      } else {
        this.table = true;
        if (this.data.patient_id) {
          queryPronTherapyRecordList({
            type: "prone_position_type",
            patientId: this.data.patient_id,
          }).then((res) => {
            this.gridData = res.data;
          });
        }
      }
    },
    // 选择
    choice(scope) {
      const ids = scope.row.rowId;
      queryDataPronTherapyRecord({
        status: 1,
        patientId: this.data.patient_id,
        rowId: ids,
        type: "prone_position_type",
      }).then((res) => {
        console.log(res.data);
        if (res.code === 200) {
          this.info = res.data;
          this.$message({
            message: "选择成功",
            type: "success",
          });
        } else {
          this.$message({
            message: "选择失败",
            type: "warning",
          });
        }
      });
    },
    //删除
    yes(scope) {
      pronTherapyRecordDelete({
        rowId: scope.row.rowId,
      }).then((res) => {
        this.$message({
          message: "删除成功",
          type: "success",
        });
        this.histion();
      });
      scope._self.$refs[`popover-${scope.$index}`].doClose();
    },
    //取消删除
    no(scope) {
      this.$message("取消删除");
      scope._self.$refs[`popover-${scope.$index}`].doClose();
    },
  },
};
</script>

<style scoped>
.warp {
  width: 940px;
  height: auto;
  border: 1px solid #808695;
  margin: 0 auto;
}
.one {
  width: 940px;
  height: 50px;
  border-bottom: 1px solid #808695;
}
.two {
  width: 940px;
  height: 30px;
  border-bottom: 1px solid #808695;
}
.one /deep/ .el-input__inner {
  border: none;
}
.two /deep/ .el-input__inner {
  border: none;
}
.short_div {
  width: 100px;
  height: 30px;
  border: 1px solid #808695;
  float: left;
  text-align: center;
}
.shorter_div {
  width: 215px;
  height: 30px;
  border: 1px solid #808695;
  float: left;
  text-align: center;
}
.long_div {
  width: 175px;
  height: 30px;
  border: 1px solid #808695;
  float: left;
  text-align: center;
}
.longer_div {
  width: 200px;
  height: 30px;
  border: 1px solid #808695;
  float: left;
  text-align: center;
}
.longger_div {
  width: 200px;
  height: 30px;
  border: 1px solid #808695;
  float: left;
  text-align: center;
}
.title_div {
  text-align: center;
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 10px;
}
.input-type {
  width: 60px;
  text-align: center;
  border: 0px;
  outline: none;
  height: 14px;
}
#date_div /deep/ .el-input__inner {
  border: 0;
  height: 12px;
  width: 200px;
}
#date_div /deep/ .el-icon-time:before {
  content: "";
}
#date_div /deep/ .el-input__icon {
  width: 0;
}
#dateTime_div /deep/ input.el-input__inner {
  border: 0;
  width: 40px;
  height: 20px;
}
#dateTime_div /deep/ .el-icon-date:before {
  width: 0;
  content: "";
}
#dateTime_div /deep/ .el-icon-date:after {
  width: 0;
  content: "";
}
#dateTime_div /deep/ .el-input__suffix-inner {
  width: 0;
}
#dateTime_div /deep/ .el-input__icon {
  width: 0;
}
#dateTime_div /deep/ .el-input__prefix {
  width: 0;
}
#dateTime_div /deep/ .el-input__suffix {
  width: 0;
}
/deep/ .el-select-dropdown__wrap.el-scrollbar__wrap {
  margin-bottom: 0 !important;
}
</style>

